<?php
require_once('Kbs/Controller/Action.php');

class LanguageController extends Kbs_Controller_Action
{
    public function switchAction()
    {
        if ($this->getRequest()->isGet()) {
            if ($this->_hasParam('locale')) {
                $localeId = $this->_getParam('locale');
                $session = new Zend_Session_Namespace('locale');
                $session->localeId = $localeId;
            }
        }

        $sessionUrl = new Zend_Session_Namespace('currentRail');
        if (isset($sessionUrl->currentRail)) {
			$this->_redirect($sessionUrl->currentRail);
		} else {
            $this->_redirect('/');
		}
    }
}
